package com.wh.aop.aspect;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.stereotype.Component;

@Slf4j
//@Aspect
//@Component
public class AspectText1 {

    @Before("com.wh.aop.aspect.AspectText2.pt()")
    public void doBefore() {
        log.info("AspectText do before....");
    }

    @After("execution(* com.wh.aop.controller.*.*(..))")
    public void doAfter() {
        log.info("AspectText do after....");
    }

    @Around("execution(* com.wh.aop.controller.*.*(..))")
    public Object doAround(ProceedingJoinPoint joinPoint) throws Throwable {
        log.info("AspectText do around before....");
        Object proceed = joinPoint.proceed();
        log.info("AspectText do around after....");
        return proceed;
    }

    @AfterReturning("execution(* com.wh.aop.controller.*.*(..))")
    public void doAfterReturning() {
        log.info("AspectDemo do AfterReturning....");
    }

    @AfterThrowing("execution(* com.wh.aop.controller.*.*(..))")
    public void doAfterThrowing() {
        log.info("AspectDemo do AfterThrowing....");
    }
}
